Optimistic and pessimistic concurrency control